import pymongo
import requests
myclient = pymongo.MongoClient("mongodb://10.10.24.146:27017/")
mydb = myclient["test"]
mycol = mydb["websites"]
url = "http://www.baidu.com/"
res = requests.get(url)
res.encoding = 'utf-8'
html = res.text

def insert():
    mydict = {"url":"http://www.baidu.com/","name":"汪骏阳","html":html}
    x=mycol.insert_one(mydict)
    
def index():
    data=myclient['test']['weather'].find()
    return render_template('test.html',data=data)
if __name__ == '__main__':
    app.run(host="0.0.0.0",port=5000)
    
